@extends('layout.index')
@section('title', '添加商品')
@section('content')
     <script type="text/javascript" charset="utf-8" src="/adminHTML/UEditor/ueditor.config.js"></script>
     <script type="text/javascript" charset="utf-8" src="/adminHTML/UEditor/ueditor.all.min.js"> </script>
     <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
     <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
     <script type="text/javascript" charset="utf-8" src="/adminHTML/UEditor/lang/zh-cn/zh-cn.js"></script>
	<div class="mws-panel grid_8">
                	<div class="mws-panel-header">
                    	<span>商品添加</span>
                    </div>
                    <div class="mws-panel-body no-padding">
                    	<form action="{{url('admin/goods/insert')}}" class="mws-form" method='post' enctype="multipart/form-data">
                    		@if (count($errors) > 0)
                    		    <div class="mws-form-message error">
                    		    添加失败
                    		        <ul>
                    		            @foreach ($errors->all() as $error)
                    		                <li>{{ $error }}</li>
                    		            @endforeach
                    		        </ul>
                    		    </div>
                    		@endif
                    		<div class="mws-form-inline">
                                   <div class='mws-form-row'>
                                        <label class='mws-form-label'>商品分类</label>
                                        <div class='mws-form-item'>
                                             <select name="sortid" class='small'>
                                                  @foreach($cates as $k=>$v)
                                                  <option value="{{$v->sorid}}">{{$v->sorname}}</option>
                                                  @endforeach
                                             </select>
                                        </div>
                                   </div>
                    			<div class="mws-form-row">
                    				<label class="mws-form-label">商品名称</label>
                    				<div class="mws-form-item">
                    					<input type="text" class="small" name='goodname'>
                    				</div>
                    			</div>
                                   <div class="mws-form-row">
                                        <label class="mws-form-label">商品价格</label>
                                        <div class="mws-form-item">
                                             <input type="text" class="small" name='price'>
                                        </div>
                                   </div>
                                   <div class="mws-form-row">
                                        <label class="mws-form-label">商品库存</label>
                                        <div class="mws-form-item">
                                             <input type="text" class="small" name='stock'>
                                        </div>
                                   </div>
                                   <div class="mws-form-row">
                                        <label class="mws-form-label">商品状态</label>
                                        <div class="mws-form-item">
                                             <select name="status">
                                                  <option value="0">正常</option>                                          
                                                  <option value="1">推荐</option>                                          
                                                  <option value="2">热门</option>                                          
                                             </select>
                                        </div>
                                   </div>
                                   <div class="mws-form-row">
                                        <label class="mws-form-label">商品详情</label>
                                        <div class="mws-form-item">
                                            <script id="container" name="content" type="text/plain">
                                                        请填写商品详情
                                             </script>
                                        </div>
                                   </div>

                                   <div class="mws-form-row">
                                        <label class="mws-form-label">商品图片</label>
                                        <div class="mws-form-item">
                                             <input type="file" class="small" name='goodpic' >
                                        </div>
                                   </div>
                                   {{csrf_field()}}
                                  
                    		</div>
                    		<div class="mws-button-row">
                    			<input type="submit" class="btn btn-danger" value="提交">
                    			<input type="reset" class="btn " value="重置">
                    		</div>
                    	</form>
                    </div>    	
    </div>
    <script type="text/javascript">
            var ue = UE.getEditor('container');
     </script>
@endsection